<!DOCTYPE html>

<html class="no-js">

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title></title>
  <meta name="description" content="" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />

  <script src="https://cdn.staticfile.org/axios/0.19.0-beta.1/axios.js"></script>

  <script src="../../cdn/vue/vue.global.min.js"></script>

  <link rel="stylesheet" href="../../cdn/element-plus/index.css" />
  <script src="../../cdn/element-plus/index.full.min.js"></script>
  <link rel="stylesheet" href="../../../lib/index.css" />
  <script src="../../../lib/avue.js"></script>
</head>

<body>
  <div id="app">
    {{form}}
    <avue-search :option="option" @change="handleChange">
      <template #zdy="scope">
        <el-tag>自定义</el-tag>
      </template>
    </avue-search>
    <avue-crud :option="tableOption" :data="data"></avue-crud>
  </div>
</body>
<script>
  var app = Vue.createApp({
    data() {
      return {
        tableOption: {
          border: true,
          index: true,
          column: [{
            label: '姓名',
            prop: 'name'
          }, {
            label: '多选',
            prop: 'checkbox',
            multiple: false,
            dicData: [{
              label: '单层',
              value: 0
            }, {
              label: '多层',
              value: 1
            }]
          }, {
            label: '交通工具',
            prop: 'jtgj',
            dicData: [{
              label: '飞机',
              value: 0
            }, {
              label: '动车',
              value: 1
            }, {
              label: '驾车',
              value: 2
            }, {
              label: '其他',
              value: 3
            }]
          }]
        },
        data: [{
          name: '张三',
          checkbox: 0,
          jtgj: [0, 1, 2, 3]
        }, {
          name: '李四',
          checkbox: 1,
          jtgj: [0, 1, 2, 3]
        }],
        form: {

        },
        option: {
          column: [{
            label: '自定义',
            prop: 'zdy'
          }, {
            label: '地区',
            prop: 'zt',
            dicUrl: 'https://cli.avuejs.com/api/area/getProvince',
            props: {
              label: 'name',
              value: 'code'
            }
          }, {
            label: '多选',
            prop: 'checkbox',
            multiple: false,
            dicData: [{
              label: '单层',
              value: 0
            }, {
              label: '多层',
              value: 1
            }]
          }, {
            label: '交通工具',
            prop: 'jtgj',
            dicData: [{
              label: '飞机',
              value: 0
            }, {
              label: '动车',
              value: 1
            }, {
              label: '驾车',
              value: 2
            }, {
              label: '其他',
              value: 3
            }]
          }]
        }
      }
    },
    methods: {
      handleChange(form) {
        this.$message.success(JSON.stringify(form))
      }
    }
  })
  app.use(ElementPlus)
  app.use(AVUE)
  app.mount('#app')
</script>

</html>